home *** CD-ROM | disk | FTP | other *** search
- Path: lasernet.com!jonathan_wooldridge
- Newsgroups: comp.lang.c++
- Message-ID: <60114202823$71C7@lasernet.com>
- X-Gateway: Act-Up 4.6 14 Jan 96 20:28:23 LaserNet, Serving Fido style systems
- Date: Sun, 14 Jan 96 19:59:49 LOC
- Organization: 1BBS ■ Imperial Beach CA ■ 619∙429∙6521/6123 ■ (52:1000/153)
- From: Jonathan Wooldridge <jonathan_wooldridge@lasernet.com>
- Subject: Borland C++ asm{labels}
-
- Hey, here's a joystick routine I've been trying to get working,
- but I keep getting an "Undefined label 'Again:'" error.
- I'm using Borland C++ v3.1, and this is my first attempt at an
- in-line assembler routine, so bear with me...
-
- inline word Joystick::Position(int StickNum){
- word mask = 0x1 << StickNumber; // 0-Ax, 1-Ay, 2-Bx, 3-By
- asm{
- CLI ;// turn off interrupts for timing loop
-
- MOV BX, mask ;
- MOV DX, GAMEPORT ;// Defined as 0x201 in header
- MOV CX, 0 ;// prepare to loop 65,535 times
- OUT DX, AL ;// send <anything>...
- Again: ;// HERE'S ME LABEL
- IN AL, DX ;// recieve
- TEST AL, AH ;// compare In with mask
- LOOPNE Again; ;// Bail if bit changed, or CX down to 0
-
- MOV AX, 0 ;// subtract CX from 0 to get count of iterations
- SUB AX, CX
-
- STI ;// restore interrupts
- };
- return(_AX);
- };
-
- The line that has the label 'Again:' in it produces an "unrecognized command"
- error, and the line 'LOOPNE Again;' produces "Undefined Label"
-
- Any help would be greatly appreciated :)
-
- -SpyroGyra
- ... "42? 7 and a half million years and all you can come up with is 42?!"
- ---
- * TLX v4.00 *
-
- ---
-